[SOLARIS] A couple of simple compile fixes for tools/ on Solaris.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 17 Oct 2006 17:15:59 +0000 (18:15 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 17 Oct 2006 17:15:59 +0000 (18:15 +0100)
Signed-off-by: John Levon <john.levon@sun.com>
config/Linux.mk
config/SunOS.mk
tools/console/daemon/io.c
tools/console/daemon/utils.c
tools/ioemu/vl.c
tools/libxc/xg_private.c
tools/xcutils/readnotes.c
tools/xenstat/xentop/Makefile
tools/xenstat/xentop/xentop.c
tools/xenstore/xenstored_core.c
tools/xenstore/xsls.c

index babe2b7a85e5644ae776bfad711eebc086b5a0c3..91363906d1f06e0c36678075990e80d6587a5f4d 100644 (file)
@@ -21,6 +21,7 @@ INSTALL_PROG = $(INSTALL) -m0755
 LIB64DIR = lib64
 
 SOCKET_LIBS =
+CURSES_LIBS = -lncurses
 SONAME_LDFLAG = -soname
 SHLIB_CFLAGS = -shared
 
index d18ad14bd9c781f9306075b3a37fe36f10ed308c..d409d04aba91f0518d42418bec29299531e970d4 100644 (file)
@@ -22,6 +22,7 @@ INSTALL_PROG = $(INSTALL) -m0755
 LIB64DIR = lib/amd64
 
 SOCKET_LIBS = -lsocket
+CURSES_LIBS = -lcurses
 SONAME_LDFLAG = -h
 SHLIB_CFLAGS = -static-libgcc -shared
 
index 8bb18cafab7dba31ea6152da62463a148dbf6752..25ca40372fd824851eb2b87d6e3d22eb5b532421 100644 (file)
@@ -147,7 +147,7 @@ static int domain_create_tty(struct domain *dom)
        int master;
        bool success;
 
-       if ((master = getpt()) == -1 ||
+       if ((master = open("/dev/ptmx",O_RDWR|O_NOCTTY)) == -1 ||
            grantpt(master) == -1 || unlockpt(master) == -1) {
                dolog(LOG_ERR, "Failed to create tty for domain-%d",
                      dom->domid);
index 40c64211d2e71502026dc9bb0d40bf6621d351c9..0801a6ccd668d91332d976c09c19876b56221af7 100644 (file)
@@ -95,7 +95,7 @@ void daemonize(const char *pidfile)
                exit(1);
        }
 
-       len = sprintf(buf, "%d\n", getpid());
+       len = sprintf(buf, "%ld\n", (long)getpid());
        if (write(fd, buf, len) < 0)
                exit(1);
 
index f5ce725a72b19249bea0fa799d953c368c0ce621..07ef43bda9f2bdc8eaccd785a47a04f82cd7b7f1 100644 (file)
@@ -3028,7 +3028,7 @@ void net_slirp_smb(const char *exported_dir)
     }
 
     /* XXX: better tmp dir construction */
-    snprintf(smb_dir, sizeof(smb_dir), "/tmp/qemu-smb.%d", getpid());
+    snprintf(smb_dir, sizeof(smb_dir), "/tmp/qemu-smb.%ld", (long)getpid());
     if (mkdir(smb_dir, 0700) < 0) {
         fprintf(stderr, "qemu: could not create samba server dir '%s'\n", smb_dir);
         exit(1);
@@ -3995,7 +3995,7 @@ static void create_pidfile(const char *filename)
                 perror("Opening pidfile");
                 exit(1);
             }
-            fprintf(f, "%d\n", getpid());
+            fprintf(f, "%ld\n", (long)getpid());
             fclose(f);
             pid_filename = qemu_strdup(filename);
             if (!pid_filename) {
@@ -5942,7 +5942,7 @@ int main(int argc, char **argv)
     memset(&vnclisten_addr.sin_addr, 0, sizeof(vnclisten_addr.sin_addr));
     
     /* init debug */
-    sprintf(qemu_dm_logfilename, "/var/log/xen/qemu-dm.%d.log", getpid());
+    sprintf(qemu_dm_logfilename, "/var/log/xen/qemu-dm.%ld.log", (long)getpid());
     cpu_set_log_filename(qemu_dm_logfilename);
     cpu_set_log(0);
     
index 083aafa7e6836b01ede073d94cc5f5222c24ded3..a23d05de51ea54ae73f8ce2f683ea5dafbdfa105 100644 (file)
@@ -7,6 +7,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <zlib.h>
+#include <strings.h>
 
 #include "xg_private.h"
 
index af4162a558646563e0b06e9e1956f061c60e7b8c..cbd177a88f4b50e040775c176189efe358f444e9 100644 (file)
@@ -56,7 +56,8 @@ static void print_numeric_note(const char *prefix,Elf_Nhdr *note)
                       prefix, *(uint64_t *)ELFNOTE_DESC(note));
                break;
        default:
-               printf("%s: unknown data size %#x\n", prefix, note->n_descsz);
+               printf("%s: unknown data size %#lx\n", prefix,
+                      (unsigned long)note->n_descsz);
                break;
        }
 }
@@ -301,7 +302,8 @@ int main(int argc, char **argv)
                                print_string_note("FEATURES", note);
                                break;
                        default:
-                               printf("unknown note type %#x\n", note->n_type);
+                               printf("unknown note type %#lx\n",
+                                      (unsigned long)note->n_type);
                                break;
                        }
                }
index b97485f5d6e8393fe2d0b0ab215eaaeb666b9379..2248bfb3c31dcc9195ed2b8a308fe06fc0c4f587 100644 (file)
@@ -25,7 +25,7 @@ sbindir=$(prefix)/sbin
 
 CFLAGS += -DGCC_PRINTF -Wall -Werror -I$(XEN_LIBXENSTAT)
 LDFLAGS += -L$(XEN_LIBXENSTAT)
-LDLIBS += -lxenstat -lncurses $(SOCKET_LIBS)
+LDLIBS += -lxenstat $(CURSES_LIBS) $(SOCKET_LIBS)
 
 .PHONY: all
 all: xentop
@@ -33,6 +33,7 @@ all: xentop
 .PHONY: install
 install: xentop xentop.1
        $(INSTALL_PROG) xentop $(DESTDIR)$(sbindir)/xentop
+       $(INSTALL_DIR) $(DESTDIR)$(man1dir)
        $(INSTALL_DATA) xentop.1 $(DESTDIR)$(man1dir)/xentop.1
 
 endif
index b808bfa497d1c1549ae1594d28264928405b59e7..271f4b2bf7f1695b2c13bdcf0c93e753191304f8 100644 (file)
@@ -23,6 +23,7 @@
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdarg.h>
 #include <string.h>
 #include <sys/time.h>
 #include <time.h>
@@ -266,7 +267,7 @@ static void print(const char *fmt, ...)
        if (!batch) {
                if((current_row() < lines()-1)) {
                        va_start(args, fmt);
-                       vw_printw(stdscr, fmt, args);
+                       vwprintw(stdscr, (char *)fmt, args);
                        va_end(args);
                }
        } else {
@@ -280,7 +281,7 @@ static void print(const char *fmt, ...)
 static void attr_addstr(int attr, const char *str)
 {
        attron(attr);
-       addstr(str);
+       addstr((char *)str);
        attroff(attr);
 }
 
@@ -1035,7 +1036,9 @@ int main(int argc, char **argv)
                nonl();
                keypad(stdscr, TRUE);
                halfdelay(5);
+#ifndef __sun__
                use_default_colors();
+#endif
                init_pair(1, -1, COLOR_YELLOW);
 
                do {
index 2511e4a5fc863fffcab3fd76b2631d5864f3f8a1..d71a7732374ffd460ab5449d3897bdf7aaeec572 100644 (file)
@@ -1688,7 +1688,7 @@ static void write_pidfile(const char *pidfile)
        if (lockf(fd, F_TLOCK, 0) == -1)
                exit(0);
 
-       len = sprintf(buf, "%d\n", getpid());
+       len = sprintf(buf, "%ld\n", (long)getpid());
        if (write(fd, buf, len) != len)
                barf_perror("Writing pid file %s", pidfile);
 }
@@ -1901,7 +1901,7 @@ int main(int argc, char *argv[])
        restore_existing_connections();
 
        if (outputpid) {
-               printf("%i\n", getpid());
+               printf("%ld\n", (long)getpid());
                fflush(stdout);
        }
 
index 4d3b1aa1af4913c99ec337a6b3e736739cc86389..76677525465b5af2c48c9ceb7b108cdc76612e34 100644 (file)
@@ -6,6 +6,7 @@
 #include <getopt.h>
 #include <unistd.h>
 #include <sys/ioctl.h>
+#include <termios.h>
 
 static int max_width = 80;
 static int desired_width = 60;